<!DOCTYPE html>
<html>

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Sugar</title>
  <style>
    * {
      margin: 0;
      padding: 0;
      box-sizing: border-box;
      list-style: none;
    }

    ul {
      width: 500px;
      height: 40px;
      background-color: pink;
      border: 1px solid #f00;
      display: flex;
    }

    li {
      flex: 1;
      border: 1px solid seagreen;
      display: flex;
      justify-content: center;
      align-items: center;
    }

    li:nth-last-child(1) {
      /* width: 40px; */
      flex: 0 0 40px;
      background-color: tan;
    }
  </style>
</head>

<body>
  <ul>
    <li>项目1</li>
    <li>项目2</li>
    <li>项目3</li>
    <li>项目4</li>
  </ul>
</body>

</html>